﻿@model PhotoGallery.Models.ViewModels.AlbumViewModel
@using PhotoGallery.Views
@{
    ViewBag.Title = "Edit";
}
@section javascript{
    <script src="@Url.Content("~/Scripts/InputTypeFile.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/InputTypeFile.css")" rel="stylesheet" />
}
<h2>@Labels.edit</h2>

@using (Html.BeginForm("Edit", "Albums", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <fieldset>
        <legend>@Labels.album</legend>
        @Html.ValidationSummary(true)
        @Html.HiddenFor(model => model.Album.ID)
        @Html.HiddenFor(model => model.Album.FileName)
        @Html.HiddenFor(model => model.Album.FolderName)

        <div>
            @if (String.IsNullOrEmpty(Model.Album.FileName))
            {
                <img alt="" src="@Url.Content("~//Content//empty_album.png")" class="thumbnail-border" width="180" height="180" />
            }
            else
            {
                @*<img alt="@Model.Album.Title" src="@Url.Action("Thumbnail", new { file = Model.Album.FullFileName })" />*@
                <img alt="@Model.Album.Title"  src="@Url.Content(Model.Album.Url)" />
            }
        </div>
        <div class="editor-label">
            @Labels.uploadFile
        </div>
        <div class="editor-field">
            <div class="styleFileInput">        
              <input type="text" class="browseText" /> 
              <input type="button" value="Browse" class="browseButton" /> 
              <input type="file" name="file" accept="image/*"  class="theFileInput" >
            </div>
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Album.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Album.Title)
            @Html.ValidationMessageFor(model => model.Album.Title)
        </div>
        <div class="editor-label">
            @Labels.share
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Album.Shared,Model.selectList)
            @Html.ValidationMessageFor(model => model.Album.Shared)
        </div>
        <p>
            <input type="submit" value="@Labels.save">
            <a href="@Html.Encode(@Html.Encode(ViewBag.backUrl))" class="button-link-100" >@Labels.cancel </a>
        </p>
    </fieldset>
}

